<%= section_panel 'Components', :width => 'single', :position => 'right' do %>
  <%= ci_list(@components,
              :toolbar => {:sort_by   => [%w(Class ciClass), %w(Name ciName), %w(Created created)],
                           :filter_by => %w(ciClass ciName),
                           :compact   => false}) do |builder, target| %>
    <% builder.attributes raw(%(ciName="#{target.ciName}" created="#{target.created}" ciClass="#{target.ciClassName.split('.').last}")) %>
    <% builder.target nil %>
    <% builder.icon ci_image_url(target) %>
    <% builder.menu :none %>
    <% builder.top do %>
      <span class="topname">
        <%= link_to(target.ciName, @design ?
                                     catalog_design_platform_component_path(@design, @platform, target) :
                                     catalog_pack_platform_component_path(:platform_id => @platform, :id => target)) %>
      </span>
    <% end %>
    <% builder.middle do %>
      <%= render 'cms/cis/important', :ci => target %>
    <% end %>
    <% builder.bottom :none %>
    <% builder.status do %>
      <% if @policy_compliance %>
        <% violate_count = @policy_compliance[target.ciId] %>
        <% if violate_count == 0 %>
          <%= status_marker('policy', 'passed', 'label-success') %>
        <% else %>
          <%= status_marker('policy', "#{violate_count} failed", 'label-important') %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

<% unless @design %>
  <%= section_panel 'Info & Stats', :width => 'double', :position => 'left' do %>
    <div id="pack_info_div"><%= render('catalog/packs/info', :read_only => !has_support_permission?(Catalog::PacksController::SUPPORT_PERMISSION_PACK_MANAGEMENT)) %></div>
  <% end %>

  <div id="pack_visibility_div"><%= render('catalog/packs/visibility') %></div>
  <% if @cloud_whitelist.present? %>
    <%= section_panel 'Cloud White List By Namespace', :width => 'double', :position => 'left' do %>
      <pre><small><%= JSON.pretty_unparse(@cloud_whitelist) %></small></pre>
    <% end %>
  <% end %>
<% end %>

<div id="page_nav_diagram">
  <%= loading_indicator %>
</div>

<script>
  <%= remote_function(:url    => @design ?
                                   diagram_catalog_design_platform_path(@design, @platform, :size => '6,4') :
                                   diagram_catalog_pack_platform_path(:id => @platform, :size => '6,4'),
                      :method => :get) %>
</script>
